package gt.edu.usac.viewcontroller.backing.publico;

import gt.edu.usac.model.am.AppModuleImpl;

import java.io.IOException;

import javax.faces.component.UIParameter;
import javax.faces.component.html.HtmlForm;

import javax.faces.context.FacesContext;

import javax.faces.el.ValueBinding;

import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCDataControl;
import oracle.adf.view.faces.component.core.layout.CorePanelForm;
import oracle.adf.view.faces.component.core.layout.CorePanelLabelAndMessage;
import oracle.adf.view.faces.component.core.nav.CoreCommandButton;
import oracle.adf.view.faces.component.core.output.CoreOutputLabel;
import oracle.adf.view.faces.component.core.output.CoreOutputText;
import oracle.adf.view.faces.component.html.HtmlBody;
import oracle.adf.view.faces.component.html.HtmlHead;
import oracle.adf.view.faces.component.html.HtmlHtml;

import oracle.jbo.ApplicationModule;

public class PreasignacionCompletada {


    private HtmlHtml html1;
    private HtmlHead head1;
    private HtmlBody body1;
    private HtmlForm form1;
    private CoreOutputLabel outputLabel1;
    private String pidPersona;
    private CorePanelForm panelForm1;
    private CorePanelLabelAndMessage panelLabelAndMessage1;
    private CoreOutputText outputText1;
    private CorePanelLabelAndMessage panelLabelAndMessage2;
    private CoreOutputText outputText2;
    private CorePanelLabelAndMessage panelLabelAndMessage3;
    private CoreOutputText outputText3;
    private CorePanelLabelAndMessage panelLabelAndMessage4;
    private CoreOutputText outputText4;
    private CorePanelLabelAndMessage panelLabelAndMessage5;
    private CoreOutputText outputText5;
    private CorePanelLabelAndMessage panelLabelAndMessage6;
    private CoreOutputText outputText6;
    private CorePanelLabelAndMessage panelLabelAndMessage7;
    private CoreOutputText outputText7;
    private CorePanelLabelAndMessage panelLabelAndMessage8;
    private CoreOutputText outputText8;
    private CorePanelLabelAndMessage panelLabelAndMessage9;
    private CoreOutputText outputText9;
    private CorePanelLabelAndMessage panelLabelAndMessage10;
    private CoreOutputText outputText10;
    private CorePanelLabelAndMessage panelLabelAndMessage11;
    private CoreOutputText outputText11;
    private CorePanelLabelAndMessage panelLabelAndMessage12;
    private CoreOutputText outputText12;
    private CorePanelLabelAndMessage panelLabelAndMessage13;
    private CoreOutputText outputText13;
    private CorePanelLabelAndMessage panelLabelAndMessage14;
    private CoreOutputText outputText14;
    private CorePanelLabelAndMessage panelLabelAndMessage15;
    private CoreOutputText outputText15;
    private CorePanelLabelAndMessage panelLabelAndMessage16;
    private CoreOutputText outputText16;
    private CorePanelLabelAndMessage panelLabelAndMessage17;
    private CoreOutputText outputText17;
    private CoreCommandButton commandButton1;
    private CoreCommandButton commandButton2;
    private CoreCommandButton commandButton3;
    private UIParameter param1;

    public PreasignacionCompletada(){
        FacesContext ctx = FacesContext.getCurrentInstance();
                
        //Creando el binding container 
        ValueBinding vb = ctx.getApplication().createValueBinding("#{data}");
        BindingContext bc = (BindingContext)vb.getValue(ctx);
        
        DCDataControl dc  = bc.findDataControl("AppModuleDataControl");
        ApplicationModule am = (ApplicationModule)dc.getDataProvider();
        AppModuleImpl service    = (AppModuleImpl)am;
        pidPersona = service.getPreasignacionView1().getCurrentRow().getAttribute("IdPersona").toString();
    }

    public void setHtml1(HtmlHtml html1) {
        this.html1 = html1;
    }

    public HtmlHtml getHtml1() {
        return html1;
    }

    public void setHead1(HtmlHead head1) {
        this.head1 = head1;
    }

    public HtmlHead getHead1() {
        return head1;
    }

    public void setBody1(HtmlBody body1) {
        this.body1 = body1;
    }

    public HtmlBody getBody1() {
        try {
            AppModuleImpl service = getService();
            FacesContext.getCurrentInstance().getExternalContext().redirect("/calusacestudiante/preasignacion?pidpersona="+service.getPreasignacionView1().getCurrentRow().getAttribute("IdPersona"));
        } catch (IOException e) {
            System.out.println(e);
        }
        return body1;
    }

    public void setForm1(HtmlForm form1) {
        this.form1 = form1;
    }

    public HtmlForm getForm1() {
        return form1;
    }

    public void setOutputLabel1(CoreOutputLabel outputLabel1) {
        this.outputLabel1 = outputLabel1;
    }

    public CoreOutputLabel getOutputLabel1() {
        return outputLabel1;
    }

    public void setPidPersona(String pidPersona) {
        this.pidPersona = pidPersona;
    }

    public String getPidPersona() {
        return pidPersona;
    }

    public void setPanelForm1(CorePanelForm panelForm1) {
        this.panelForm1 = panelForm1;
    }

    public CorePanelForm getPanelForm1() {
        return panelForm1;
    }

    public void setPanelLabelAndMessage1(CorePanelLabelAndMessage panelLabelAndMessage1) {
        this.panelLabelAndMessage1 = panelLabelAndMessage1;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage1() {
        return panelLabelAndMessage1;
    }

    public void setOutputText1(CoreOutputText outputText1) {
        this.outputText1 = outputText1;
    }

    public CoreOutputText getOutputText1() {
        return outputText1;
    }

    public void setPanelLabelAndMessage2(CorePanelLabelAndMessage panelLabelAndMessage2) {
        this.panelLabelAndMessage2 = panelLabelAndMessage2;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage2() {
        return panelLabelAndMessage2;
    }

    public void setOutputText2(CoreOutputText outputText2) {
        this.outputText2 = outputText2;
    }

    public CoreOutputText getOutputText2() {
        return outputText2;
    }

    public void setPanelLabelAndMessage3(CorePanelLabelAndMessage panelLabelAndMessage3) {
        this.panelLabelAndMessage3 = panelLabelAndMessage3;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage3() {
        return panelLabelAndMessage3;
    }

    public void setOutputText3(CoreOutputText outputText3) {
        this.outputText3 = outputText3;
    }

    public CoreOutputText getOutputText3() {
        return outputText3;
    }

    public void setPanelLabelAndMessage4(CorePanelLabelAndMessage panelLabelAndMessage4) {
        this.panelLabelAndMessage4 = panelLabelAndMessage4;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage4() {
        return panelLabelAndMessage4;
    }

    public void setOutputText4(CoreOutputText outputText4) {
        this.outputText4 = outputText4;
    }

    public CoreOutputText getOutputText4() {
        return outputText4;
    }

    public void setPanelLabelAndMessage5(CorePanelLabelAndMessage panelLabelAndMessage5) {
        this.panelLabelAndMessage5 = panelLabelAndMessage5;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage5() {
        return panelLabelAndMessage5;
    }

    public void setOutputText5(CoreOutputText outputText5) {
        this.outputText5 = outputText5;
    }

    public CoreOutputText getOutputText5() {
        return outputText5;
    }

    public void setPanelLabelAndMessage6(CorePanelLabelAndMessage panelLabelAndMessage6) {
        this.panelLabelAndMessage6 = panelLabelAndMessage6;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage6() {
        return panelLabelAndMessage6;
    }

    public void setOutputText6(CoreOutputText outputText6) {
        this.outputText6 = outputText6;
    }

    public CoreOutputText getOutputText6() {
        return outputText6;
    }

    public void setPanelLabelAndMessage7(CorePanelLabelAndMessage panelLabelAndMessage7) {
        this.panelLabelAndMessage7 = panelLabelAndMessage7;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage7() {
        return panelLabelAndMessage7;
    }

    public void setOutputText7(CoreOutputText outputText7) {
        this.outputText7 = outputText7;
    }

    public CoreOutputText getOutputText7() {
        return outputText7;
    }

    public void setPanelLabelAndMessage8(CorePanelLabelAndMessage panelLabelAndMessage8) {
        this.panelLabelAndMessage8 = panelLabelAndMessage8;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage8() {
        return panelLabelAndMessage8;
    }

    public void setOutputText8(CoreOutputText outputText8) {
        this.outputText8 = outputText8;
    }

    public CoreOutputText getOutputText8() {
        return outputText8;
    }

    public void setPanelLabelAndMessage9(CorePanelLabelAndMessage panelLabelAndMessage9) {
        this.panelLabelAndMessage9 = panelLabelAndMessage9;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage9() {
        return panelLabelAndMessage9;
    }

    public void setOutputText9(CoreOutputText outputText9) {
        this.outputText9 = outputText9;
    }

    public CoreOutputText getOutputText9() {
        return outputText9;
    }

    public void setPanelLabelAndMessage10(CorePanelLabelAndMessage panelLabelAndMessage10) {
        this.panelLabelAndMessage10 = panelLabelAndMessage10;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage10() {
        return panelLabelAndMessage10;
    }

    public void setOutputText10(CoreOutputText outputText10) {
        this.outputText10 = outputText10;
    }

    public CoreOutputText getOutputText10() {
        return outputText10;
    }

    public void setPanelLabelAndMessage11(CorePanelLabelAndMessage panelLabelAndMessage11) {
        this.panelLabelAndMessage11 = panelLabelAndMessage11;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage11() {
        return panelLabelAndMessage11;
    }

    public void setOutputText11(CoreOutputText outputText11) {
        this.outputText11 = outputText11;
    }

    public CoreOutputText getOutputText11() {
        return outputText11;
    }

    public void setPanelLabelAndMessage12(CorePanelLabelAndMessage panelLabelAndMessage12) {
        this.panelLabelAndMessage12 = panelLabelAndMessage12;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage12() {
        return panelLabelAndMessage12;
    }

    public void setOutputText12(CoreOutputText outputText12) {
        this.outputText12 = outputText12;
    }

    public CoreOutputText getOutputText12() {
        return outputText12;
    }

    public void setPanelLabelAndMessage13(CorePanelLabelAndMessage panelLabelAndMessage13) {
        this.panelLabelAndMessage13 = panelLabelAndMessage13;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage13() {
        return panelLabelAndMessage13;
    }

    public void setOutputText13(CoreOutputText outputText13) {
        this.outputText13 = outputText13;
    }

    public CoreOutputText getOutputText13() {
        return outputText13;
    }

    public void setPanelLabelAndMessage14(CorePanelLabelAndMessage panelLabelAndMessage14) {
        this.panelLabelAndMessage14 = panelLabelAndMessage14;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage14() {
        return panelLabelAndMessage14;
    }

    public void setOutputText14(CoreOutputText outputText14) {
        this.outputText14 = outputText14;
    }

    public CoreOutputText getOutputText14() {
        return outputText14;
    }

    public void setPanelLabelAndMessage15(CorePanelLabelAndMessage panelLabelAndMessage15) {
        this.panelLabelAndMessage15 = panelLabelAndMessage15;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage15() {
        return panelLabelAndMessage15;
    }

    public void setOutputText15(CoreOutputText outputText15) {
        this.outputText15 = outputText15;
    }

    public CoreOutputText getOutputText15() {
        return outputText15;
    }

    public void setPanelLabelAndMessage16(CorePanelLabelAndMessage panelLabelAndMessage16) {
        this.panelLabelAndMessage16 = panelLabelAndMessage16;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage16() {
        return panelLabelAndMessage16;
    }

    public void setOutputText16(CoreOutputText outputText16) {
        this.outputText16 = outputText16;
    }

    public CoreOutputText getOutputText16() {
        return outputText16;
    }

    public void setPanelLabelAndMessage17(CorePanelLabelAndMessage panelLabelAndMessage17) {
        this.panelLabelAndMessage17 = panelLabelAndMessage17;
    }

    public CorePanelLabelAndMessage getPanelLabelAndMessage17() {
        return panelLabelAndMessage17;
    }

    public void setOutputText17(CoreOutputText outputText17) {
        this.outputText17 = outputText17;
    }

    public CoreOutputText getOutputText17() {
        return outputText17;
    }

    public void setCommandButton1(CoreCommandButton commandButton1) {
        this.commandButton1 = commandButton1;
    }

    public CoreCommandButton getCommandButton1() {
        return commandButton1;
    }

    public void setCommandButton2(CoreCommandButton commandButton2) {
        this.commandButton2 = commandButton2;
    }

    public CoreCommandButton getCommandButton2() {
        return commandButton2;
    }

    public void setCommandButton3(CoreCommandButton commandButton3) {
        this.commandButton3 = commandButton3;
    }

    public CoreCommandButton getCommandButton3() {
        return commandButton3;
    }

    public String report_action() {
        
        return null;
    }

    public void setParam1(UIParameter param1) {
        this.param1 = param1;
    }

    public UIParameter getParam1() {
        return param1;
    }
    
    private AppModuleImpl getService(){
        FacesContext ctx = FacesContext.getCurrentInstance();
        
        //Creando el binding container 
        ValueBinding vb = ctx.getApplication().createValueBinding("#{data}");
        BindingContext bc = (BindingContext)vb.getValue(ctx);
        
        DCDataControl dc  = bc.findDataControl("AppModuleDataControl");
        ApplicationModule am = (ApplicationModule)dc.getDataProvider();
        return (AppModuleImpl)am;
    }
}
